Home

Computer science

'

Question 1 [10]  \ufeffsetting up Study the class definitions below: class Node { // \ufeffattributes String flight_no; // \ufeffflight number Date arrival_time; // \ufefftime at which flight lands class PriorityQueue { // \ufeffattributes int currentSize; Node root; FlightNode[] \ufeffarray = \ufeffnew Node [25]// \ufeffmethods void clear(); Boolean isEmpty(); Boolean add(Node x); Node remove(); void percolateDown(int hole)} 1.1 \ufeffCreate two files Node.java and PriorityQueue.java 1.2 \ufeffCopy the above definitions into the corresponding files 1.3 \ufeffWrite code for a default and a loaded constructor for Node 1.4 \ufeffWrite code for a default and a loaded constructor for PriorityQueue 1.5 \ufeffWrite accessor and mutator methods for the attributes of Node 1.6 \ufeffWrite accessor and mutator methods for the attributes of PriorityQueue Question 2 [20]  \ufeffadding functionality Extend the PriorityQueue class: 2.1 \ufeffWrite code for the method void clear() \ufeffwhich empties the heap and resets the size to 0. 2.2 \ufeffWrite code for the method Boolean isEmpty () \ufeffthat checks whether the heap contains any elements or not. 2.3 \ufeffWrite code for the method Boolean add(Node x) \ufeffwhich adds a new node to the heap 2.4 \ufeffWrite code for the method Node remove( )which deletes the root, decreases the heap size and reorders the remaining heap. It should involve a call to a method percolateDown(int hole).Include method for 2.4 \ufeffand give full code that will run

'

Answer